/*php code*/
//var ajaxURL = "http://buzzbee.kr/s.oh/guppii_ver1/guppiiphp_ver1/";
// var ajaxURL = "http://buzzbee.kr/s.park/guppiiphp_ver1/";
// var ajaxURL = "http://buzzbee.kr/m.oh/guppiiwebPHP/";
 var ajaxURL = "http://buzzbee.kr/j.park/guppiiweb_ver1/guppiiphp_ver1/";

/*UI ASSIST*/
(function(window,undefined){
	var UIAssist = {};
	window.UIAssist = window.UIAssist || UIAssist;
	
	UIAssist.LoginBlock = function() {
		$('#logID,#logPW').blur(function() {
			if ($(this).val() != '') {
				$(this).addClass('blank');
			} else {
				$(this).removeClass('blank');
			}
		});
	};
	
	UIAssist.searchBoxBlock = function(){
		$('#searchWord').blur(function() {
			if ($(this).val() != '') {
				$(this).addClass('blank');
			} else {
				$(this).removeClass('blank');
			}
		});
	};
	
	UIAssist.LoginBlocks = function() {
		$('#loginPageID,#loginPagePW').blur(function() {
			if ($(this).val() != '') {
				$(this).addClass('blank');
			} else {
				$(this).removeClass('blank');
			}
		});
	};
	
	UIAssist.textHandler = function(options){
		var result = '';
		
		if(!options.limitLangth){/*제한할 글자 수*/
			alert('limitLangth parameter miss');
			return;
		}
		if(!options.content){/*text 내용*/
			alert('content parameter miss');
			return;
		}
		
		if(options.content.length >= options.limitLangth){
			result = options.content.slice(0,options.limitLangth) + "...";
		}else {
			result = options.content;
		}
		
		return result;
	};

})(window);

(function(window,undefined){
	$(document).off('click').on('click', 'a', function(event) {
		if ($(this).attr('href') == '#') {
			event.preventDefault();
		}
	});
	
	var defaultBlockPackage = function(){
		Category.categoryBlock();
		myBlockPackage();
	};
	
	var myBlockPackage = function(){
		Account.headerAccountBlock();
		Landmark.titleBlock();
		Landmark.rootBlock();
		Landmark.userLocationBlock();
		Landmark.recentlyLandmarkBlock();
		Landmark.footerLandmarkBlock();
		Search.searchBlock();
		
		setInterval("Cast.hotcastBlock()",2000);
	};
	
	var storeBlockPackage = function(){
		Sungmin.sellerCommon.sellerNav();
		myBlockPackage();
	};
	/*url?id=number 형태에서 nubmer 값 가져오기*/
	var getUrlId = function(){
		// var url = window.location.href.split('?');
		// var store_url = url[1].split('=');
		// var urlId = store_url[1];
		return location.search.substring(4).replace('#', '');
	};
	
	/*url주소 체크 : 주소에 id가 있을 경우와 없을경우에는 세션에 저장된 user_id를 반환*/
	var checkUrlId = function(){
		var url = window.location.href;
		if(url.indexOf('?id=')!=-1){
			return getUrlId();
		}else{
			return sessionStorage.getItem('user_id');
		}
	};
	
	window.storeBlockPackage = window.storeBlockPackage || storeBlockPackage;
	window.defaultBlockPackage = window.defaultBlockPackage || defaultBlockPackage;
	window.myBlockPackage = window.myBlockPackage || myBlockPackage;
	window.getUrlId = window.getUrlId || getUrlId;
	window.checkUrlId = window.checkUrlId || checkUrlId;
})(window);
